cmake_minimum_required(VERSION 3.10)
project(IndexedShapeKit)

set(CMAKE_INCLUDE_CURRENT_DIR ON)

if(WIN32)
    set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH};3rdparty/opencv-4.5.4)
    if(MINGW)
        file(GLOB OpenCV_DLLs 3rdparty/opencv-4.5.4/x64/mingw/bin/*.dll)
        file(COPY ${OpenCV_DLLs} DESTINATION ${CMAKE_BINARY_DIR})
    elseif(MSVC)
        message("如果需要使用MSVC编译, 请手动下载编译OpenCV的MSVC版本的动态库, 将其放在正确的位置并改写对应的宏")
    endif()
endif()

SET(PROJECT_ROOT_PATH "${PROJECT_SOURCE_DIR}")

set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(OpenCV 4 REQUIRED)
find_package(Qt5 COMPONENTS Core Widgets Test REQUIRED)

add_subdirectory(common)
add_subdirectory(shp)
add_subdirectory(converter)
add_subdirectory(palette)
add_subdirectory(test)
add_subdirectory(gui)

add_executable(IndexedShapeKit main.cpp)
target_link_libraries(IndexedShapeKit ${OpenCV_LIBS} Qt5::Widgets shp converter palette gui)

